package my2Cents.properties;

import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.KeyAdapter;

import javax.swing.JPanel;

public abstract class Property extends JPanel {
	protected KeyAdapter closeKA;
	protected Color bgColor = new Color(255,255,255);
	
	public Property() {
		this.setSize(10,20);
		this.setLayout(null);
		bgColor = this.getBackground();
		//this.setBackground(bgColor);
	}
	
	public void setCloseKeyAdapter(KeyAdapter ka) {
		this.closeKA = ka;
	}
	
	protected KeyAdapter getCloseKeyAdapter() {
		return this.closeKA;
	}
	
	public void paint(Graphics g) {
		super.paint(g);
		g.setColor(Color.lightGray);
		g.drawLine(0, getHeight()-1, getWidth(), getHeight()-1);
		//g.drawRect(1,1,getWidth()-2,getHeight()-2);
	}
	
	public void centerY(Component c) {
		int cx = c.getX();
		int ch = c.getHeight();
		int th = getHeight();
		c.setLocation(cx,(th/2)-ch/2);
	}
}
